BEGIN{
  ROWS = int(ENVIRON[ "LINES" ])
  ROWS = int(ROWS/3)
  ROWS = ( ROWS > 5 ) ? ROWS : 5
  SIZE = int(ENVIRON[ "___X_CMD_UI_ROTATE_SIZE" ])
  if (SIZE > ROWS) SIZE = int(ENVIRON[ "LINES" ]) -3
  if (SIZE <= 0) SIZE = ROWS

  PREFIX = ENVIRON[ "___X_CMD_UI_ROTATE_PREFIX" ]
  EXITCLEAR  = ENVIRON[ "___X_CMD_UI_ROTATE_EXITCLEAR" ]
  PROMPT_RUN = ENVIRON[ "___X_CMD_UI_ROTATE_PROMPT_RUN" ]
  PROMPT_END = ENVIRON[ "___X_CMD_UI_ROTATE_PROMPT_END" ]
  OUTPUT_RAW =  ENVIRON[ "___X_CMD_UI_ROTATE_OUTPUT_RAW" ]

  _errcode = ui_rotate_fromstdin( SIZE, PREFIX, EXITCLEAR, PROMPT_RUN, PROMPT_END, OUTPUT_RAW )
}

END{
  exit( _errcode )
}
